﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Colors;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;

/**
 * 单行文字 
 */
namespace Dmo_lc_2.Shape
{
    public class DBTextShape : BaseShape
    {
        public string textString;
        public double[] position;
        public double height;
        public int horizontalMode;
        public int verticalMode;
        public int justify;
        public double rotation;
        public double widthFactor;

        public DBTextShape(Entity in_entity, Transaction tr) : base(in_entity, tr)
        {
        }

        public override void Init()
        {
            shapeType = ShapeType.DBTEXT;
            shapeTypeName = shapeType.ToString();

            DBText in_shape = (DBText)mEntity;

            color = getColor();

            textString = in_shape.TextString;

            if (textString == "新建外管架") {
                Console.WriteLine("erased item");
                Color colorTemp = Color.FromColorIndex(in_shape.Color.ColorMethod, (short)in_shape.ColorIndex);
            }
            position = new double[] { in_shape.Position.X, in_shape.Position.Y, in_shape.Position.Z };
            height = in_shape.Height;
            horizontalMode = (int)in_shape.HorizontalMode;
            verticalMode = (int)in_shape.VerticalMode;

            justify = (int)in_shape.Justify;
            rotation = in_shape.Rotation;

            widthFactor = in_shape.WidthFactor;
        }
    }
}